package lecture04.arrayinf;

public class ArrayTest {
    static void main(String[] args) {  // 修正main方法的参数和访问修饰符
        int[] jiechen = new int[20];
        int total = 1;  // 将total声明在循环外部，累计计算阶乘
        for (int i = 0; i < jiechen.length; i++) {
            total *= (i + 1);  // 计算(i+1)! = i! * (i+1)
            jiechen[i] = total;
        }
        for (int j : jiechen) {
            System.out.print(j + " ");
        }
    }
}